package regexp;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created with IntelliJ IDEA
 * Description:正则选择匹配符
 * User:22954
 * Date:2024-05-27
 * Time:16:01
 */
public class Rule2 {
    /*
    |----可匹配上前置或后置的字符(串)
     */
    public static void main(String[] args) {
        String content = "你好,abc_* 哈哈";
        String regex = "你|a";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(regex);
        while(matcher.find()){
            System.out.println(matcher.group(0));
        }
    }
}
